package com.example.rpcserverboottest.service;


import com.gugugu.web.rpc.annotion.GuRpcService;
import com.guguguweb.rpc.test.interfaces.BootHelloService;
import com.guguguweb.rpc.test.interfaces.GuResultData;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

@GuRpcService
public class BootHellosServiceImp implements BootHelloService {

    private AtomicInteger count = new AtomicInteger(0);

    @Override
    public List<String> getData(String data, GuResultData resultData) {
        ArrayList<String> list = new ArrayList<>();
        list.add(data + count.incrementAndGet());
        list.add(String.valueOf(resultData));
        return list;
    }

    @Override
    public GuResultData getData(String data) {
        GuResultData result= new GuResultData();
        result.setData(data);
        result.setCode(count.incrementAndGet());
        result.setMessage("执行成功");
        return result;
    }
}
